package com.sip.dbadapter.dao.impl;

import java.io.Serializable;
import java.util.List;

import com.sip.dbadapter.dao.domain.ConsumeTemplate;
import com.sip.dbadapter.dao.exception.CustomException;
import com.sip.dbadapter.dao.interfaces.ConsumeTemplateSelectDao;

public class ConsumeTemplateSelectDaoImpl extends BusinessDaoImpl<ConsumeTemplate, Serializable> implements ConsumeTemplateSelectDao{
	@Override
	public ConsumeTemplate findById(Serializable id) throws CustomException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<Object> getConsumeTemplateData(String templateId) {
		// TODO Auto-generated method stub

		List<Object> consumeTemplateList=(List<Object>) exec("select A from " + getDomainClass().getName() + " A where A.templateId='"+templateId+"'");
		return consumeTemplateList;
	}
	
	@Override
	public List<Object> getConsumeTemplateData(long apiId) {
		// TODO Auto-generated method stub

		List<Object> consumeTemplateList=(List<Object>) exec("select A from " + getDomainClass().getName() + " A where A.scanTypeWs='"+apiId+"' or  A.scanTypeRmi='"+apiId+"'or  A.scanTypeRest='"+apiId+"'");
		return consumeTemplateList;
	}
	
	@Override
	public List<Object> getConsumeTemplateData(String consumeId,long apiId) {
		// TODO Auto-generated method stub

		List<Object> consumeTemplateList=(List<Object>) exec("select A from " + getDomainClass().getName() + " A where  A.templateId='"+consumeId+"' and (A.scanTypeWs='"+apiId+"' or  A.scanTypeRmi='"+apiId+"'or  A.scanTypeRest='"+apiId+"' ) ");
		return consumeTemplateList;
	}

	@Override
	protected Class<ConsumeTemplate> getDomainClass() {
		// TODO Auto-generated method stub
		return ConsumeTemplate.class;
	}
}
